Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc commented Sep 25, 2025

Proposed changes (including videos or screenshots)

With this change, all signals exchanged between rocket.chat client and server within the context of a voice call are going to be stored on a mongo collection for three days, so that they can be reviewed in case of unexpected issues.

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • Introduced media call channel logging, capturing sent and received signaling events to improve troubleshooting and support.
    • Logs are automatically retained for 3 days, aiding short-term diagnostics without long-term storage overhead.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 25, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Sep 25, 2025

⚠️ No Changeset found

Latest commit: d1da33e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds a new MediaCallChannelLogs model and typings, registers it in the Meteor server, and integrates non-blocking logging of media signaling (send/recv) in CallSignalProcessor. Defines TTL and composite indexes for the new collection. Exposes new interfaces and model types via core/model typings and models package indices.

Changes

Cohort / File(s) Summary
Server model registry
apps/meteor/server/models.ts
Imports MediaCallChannelLogsRaw and registers IMediaCallChannelLogsModel using MediaCallChannelLogsRaw(db).
Core typings
packages/core-typings/src/mediaCalls/IMediaCallChannelLog.ts, packages/core-typings/src/mediaCalls/index.ts
Adds IMediaCallChannelLog interface and re-exports it from the mediaCalls barrel.
Model typings
packages/model-typings/src/models/IMediaCallChannelLogsModel.ts, packages/model-typings/src/index.ts
Introduces IMediaCallChannelLogsModel type alias and exports it from the index.
Models package exports
packages/models/src/index.ts, packages/models/src/modelClasses.ts
Exposes IMediaCallChannelLogsModel via proxify and re-exports MediaCallChannelLogs.
New model implementation
packages/models/src/models/MediaCallChannelLogs.ts
Implements MediaCallChannelLogsRaw with composite index on { callId, channelId } and TTL index on ts (3 days).
Media signaling logging
ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts
Inserts non-blocking logs to MediaCallChannelLogs on received and sent signals (`direction: 'recv'

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UA as UserActorSignalProcessor
  participant MCP as MediaCallChannelLogs Model
  participant HS as Handler/Server

  rect rgba(220,240,255,0.4)
    note over UA: processSignal (incoming)
    UA->>MCP: insert({ callId, channelId, direction: "recv", ts, content })
    note over MCP: Non-blocking (errors ignored)
    UA->>HS: handle incoming signal
  end

  rect rgba(220,255,220,0.4)
    note over UA: sendSignal (outgoing)
    UA->>MCP: insert({ callId, channelId, direction: "send", ts, content })
    note over MCP: Non-blocking (errors ignored)
    UA->>HS: forward signal to server
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • tassoevan
  • KevLehman

Poem

In whispering wires my packets hop,
I thump my paws—log every drop.
Send or recv, the carrots tally,
Three days’ tales in TTL alley.
Burrowed bytes in channels snug—
A rabbit signs, with audit hug. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly indicates that media call signals will be stored in MongoDB for three days, matching the main functionality added in this PR. It uses the conventional chore prefix and omits unnecessary details, making it concise and readable. The title is closely aligned with the objective of persisting call signals with a TTL, so it accurately summarizes the primary change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.82%. Comparing base (157c0d1) to head (d1da33e).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37069      +/-   ##
===========================================
+ Coverage    67.79%   67.82%   +0.03%     
===========================================
  Files         3345     3343       -2     
  Lines       114470   114350     -120     
  Branches     20716    20754      +38     
===========================================
- Hits         77605    77563      -42     
+ Misses       34178    34104      -74     
+ Partials      2687     2683       -4     
Flag Coverage Δ
e2e 57.51% <ø> (+0.03%) ⬆️
unit 71.83% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as ready for review September 26, 2025 13:36
@pierre-lehnen-rc pierre-lehnen-rc requested review from a team as code owners September 26, 2025 13:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (5)
packages/models/src/index.ts (1)

234-267: Consider registering the model for service contexts too (optional).

If any non-Meteor service needs to read/write channel logs, add a registration in registerServiceModels; otherwise ignore.

Apply this diff if needed:

+import { MediaCallChannelLogsRaw } from './modelClasses';
...
 export function registerServiceModels(db: Db, trash?: Collection<RocketChatRecordDeleted<any>>): void {
...
+  registerModel('IMediaCallChannelLogsModel', () => new MediaCallChannelLogsRaw(db));
 }
packages/core-typings/src/mediaCalls/IMediaCallChannelLog.ts (1)

3-13: Interface shape looks correct.

Minimal fields with TTL on ts at the model layer. Consider typing content more narrowly later to improve safety.

packages/models/src/models/MediaCallChannelLogs.ts (3)

12-21: Add a compound index including ts to support time-ordered queries

Likely access pattern: fetch recent events for a call/channel sorted by ts. Without ts in the index, sorting/range scans will be less efficient.

Apply this diff to add a supporting index (keep TTL on ts as a separate single-field index):

 protected modelIndexes(): IndexDescription[] {
   return [
     {
       key: { callId: 1, channelId: 1 },
       unique: false,
     },
+    {
+      key: { callId: 1, channelId: 1, ts: -1 },
+    },
     // Allow 3 days of events to be saved
     { key: { ts: 1 }, expireAfterSeconds: 3 * 24 * 60 * 60 },
   ];
 }

18-20: Name the TTL index and avoid magic numbers (use a constant)

Adds stability across driver versions and eases future retention changes.

Apply this diff here:

-      { key: { ts: 1 }, expireAfterSeconds: 3 * 24 * 60 * 60 },
+      { key: { ts: 1 }, expireAfterSeconds: MEDIA_CALL_LOG_TTL_SECONDS, name: 'ttl_ts' },

And add this at the top of the file (outside the selected lines):

const MEDIA_CALL_LOG_TTL_SECONDS = 3 * 24 * 60 * 60; // 3 days

15-17: Drop redundant unique: false

Non-unique is the default; removing it simplifies the spec.

Apply this diff:

-    {
-      key: { callId: 1, channelId: 1 },
-      unique: false,
-    },
+    {
+      key: { callId: 1, channelId: 1 },
+    },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between de51a86 and b69428c.

📒 Files selected for processing (9)
  • apps/meteor/server/models.ts (2 hunks)
  • ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts (3 hunks)
  • packages/core-typings/src/mediaCalls/IMediaCallChannelLog.ts (1 hunks)
  • packages/core-typings/src/mediaCalls/index.ts (1 hunks)
  • packages/model-typings/src/index.ts (1 hunks)
  • packages/model-typings/src/models/IMediaCallChannelLogsModel.ts (1 hunks)
  • packages/models/src/index.ts (2 hunks)
  • packages/models/src/modelClasses.ts (1 hunks)
  • packages/models/src/models/MediaCallChannelLogs.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
apps/meteor/server/models.ts (1)
packages/models/src/models/MediaCallChannelLogs.ts (1)
  • MediaCallChannelLogsRaw (7-22)
ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts (1)
packages/models/src/index.ts (1)
  • MediaCallChannelLogs (189-189)
packages/models/src/models/MediaCallChannelLogs.ts (2)
packages/core-typings/src/mediaCalls/IMediaCallChannelLog.ts (1)
  • IMediaCallChannelLog (3-13)
packages/model-typings/src/models/IMediaCallChannelLogsModel.ts (1)
  • IMediaCallChannelLogsModel (5-5)
packages/model-typings/src/models/IMediaCallChannelLogsModel.ts (1)
packages/core-typings/src/mediaCalls/IMediaCallChannelLog.ts (1)
  • IMediaCallChannelLog (3-13)
packages/models/src/index.ts (2)
packages/core-services/src/index.ts (1)
  • proxify (131-131)
packages/model-typings/src/models/IMediaCallChannelLogsModel.ts (1)
  • IMediaCallChannelLogsModel (5-5)
🔇 Additional comments (9)
packages/model-typings/src/models/IMediaCallChannelLogsModel.ts (1)

1-5: Typings addition looks good.

Straightforward alias to IBaseModel with correct import types.

packages/models/src/index.ts (2)

95-97: Good addition to public typings import list.

Keeps proxify typing aligned.


189-189: Proxified model export looks correct.

Identifier matches the registration key and typing.

packages/model-typings/src/index.ts (1)

88-89: Barrel re-export LGTM.

Exposes the new model typing publicly.

packages/core-typings/src/mediaCalls/index.ts (1)

3-3: Public re-export LGTM.

Makes the log interface available to consumers.

packages/models/src/modelClasses.ts (1)

80-80: Model re-export LGTM.

Surfaces MediaCallChannelLogsRaw consistently with other models.

apps/meteor/server/models.ts (2)

48-49: Import addition LGTM.

Brings the new Raw model into the registry scope.


143-144: Model registration LGTM.

Key matches proxify identifier; indexes will be created on startup.

packages/models/src/models/MediaCallChannelLogs.ts (1)

12-21: Verify index shapes against actual queries
No .find* or .sort({ ts:… }) usages found; confirm whether queries filter by channelId or sort by ts and add a compound index { channelId: 1, ts: -1 } if needed.

@pierre-lehnen-rc pierre-lehnen-rc added the stat: QA assured Means it has been tested and approved by a company insider label Sep 26, 2025
@pierre-lehnen-rc pierre-lehnen-rc added this to the 7.11.0 milestone Sep 26, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 26, 2025
Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd need a very (VERY) good reason to do this. can you elaborate please? we should use regular logs for this purpose and not store on db

@pierre-lehnen-rc pierre-lehnen-rc modified the milestones: 7.11.0, 7.12.0 Oct 9, 2025
@pierre-lehnen-rc pierre-lehnen-rc removed the stat: QA assured Means it has been tested and approved by a company insider label Oct 9, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Oct 9, 2025
@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as draft October 9, 2025 22:39
@dougfabris dougfabris modified the milestones: 7.12.0, 7.13.0 Oct 18, 2025
@pierre-lehnen-rc pierre-lehnen-rc removed this from the 7.13.0 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants